-
Notifications
You must be signed in to change notification settings - Fork 741
Support negative dimensions on "aten.split_with_sizes_copy.default" #16006
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Support negative dimensions on "aten.split_with_sizes_copy.default" #16006
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/16006
Note: Links to docs will display an error until the docs builds have been completed. ❗ 2 Active SEVsThere are 2 currently active SEVs. If your PR is affected, please view them below:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
Hi @jgibson2! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at [email protected]. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds support for negative dimension indexing in the aten.split_with_sizes_copy.default operator for the MPS backend. When a negative dimension is provided, it is converted to its positive equivalent by adding the input tensor's rank.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if dim < 0: | ||
| dim += len(input_shape) | ||
|
|
||
| if dim < 0 or dim >= len(input_shape): |
Copilot
AI
Nov 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The validation condition on line 249 will always fail for negative dimensions after normalization. If the original dim was less than -len(input_shape), the normalized value will still be negative, but this is the intended behavior to catch out-of-bounds dimensions. However, the current implementation normalizes first, then validates, which means valid negative dimensions are handled correctly but the error condition dim < 0 is now checking the normalized value. The validation should only check dim >= len(input_shape) after normalization, or validate the original dimension range before normalization.
| if dim < 0 or dim >= len(input_shape): | |
| if dim >= len(input_shape): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The negative dimension could be outside the correct range even after normalization (e.g. if there are two dimensions and the input dimension is -3). This should probably still be an error.
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
Summary
Support a negative dimension for MPS SplitWithSizes implementation.
Test plan
I re-registered this node visitor on a model that previously failed to export with the error message
and it succeeded.